package cn.xopencode.recordservice.provider.lowroom;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.manager.lowroom.LowRoomRecordManager;
import cn.xopencode.recordservice.rpc.lowroom.LowRoomRecordRpc;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordCreateDTO;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordPageDTO;
import cn.xopencode.recordservice.rpc.lowroom.dto.LowRoomRecordUpdateDTO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordAdminPageVO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordPageVO;
import cn.xopencode.recordservice.rpc.lowroom.vo.LowRoomRecordUpdateVO;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 低压配电室巡检记录 Rpc 实现类
 */
@DubboService(version = "${dubbo.provider.LowRoomRecordRpc.version}")
public class LowRoomRecordRpcImpl implements LowRoomRecordRpc {

    @Autowired
    private LowRoomRecordManager lowRoomRecordManager;

    @Override
    public CommonResult<Integer> createLowRoomRecord(LowRoomRecordCreateDTO createDTO) {
        Integer result = lowRoomRecordManager.createLowRoomRecord(createDTO);
        return CommonResult.success(result);
    }


    @Override
    public CommonResult<PageResult<LowRoomRecordPageVO>> pageLowRoomRecord(LowRoomRecordPageDTO pageDTO) {
        return CommonResult.success(lowRoomRecordManager.pageLowRoomRecord(pageDTO));
    }

    @Override
    public CommonResult<LowRoomRecordUpdateVO> getLowRoomRecordById(String id) {
        return CommonResult.success(lowRoomRecordManager.getLowRoomRecordById(id));
    }

    @Override
    public CommonResult<Integer> updateLowRoomRecord(LowRoomRecordUpdateDTO updateDTO) {
        Integer result = lowRoomRecordManager.updateLowRoomRecord(updateDTO);
        return CommonResult.success(result);
    }

    @Override
    public CommonResult<Integer> dealLowRoomRecordException(String recordId) {
        return CommonResult.success(lowRoomRecordManager.dealLowRoomRecordException(recordId));
    }

    @Override
    public CommonResult<PageResult<LowRoomRecordAdminPageVO>> getAdminPageLowRoomRecord(AdminRecordPageDTO pageDTO) {
        return CommonResult.success(lowRoomRecordManager.getPageAdminLowRoomRecord(pageDTO));
    }
}
